<template>
	<div id="nav" class="container text-center my-3">
		<router-link class="btn btn-primary mx-2" to="/">Home</router-link>
		<router-link class="btn btn-danger mx-2" to="/about">About</router-link>
	</div>
	<router-view />
</template>

<script>
import { defineComponent } from "vue"

export default defineComponent({
	name: "App",
	setup() {
		console.log("App Loaded")

		var ws = new WebSocket("ws://localhost:9090/ws")
		let count = 0

		console.log("wswswswsws", ws)
		ws.onmessage = msg => {
			count++
			console.log("received message ===> ", msg)
		}

		setInterval(() => {
			ws.send(
				JSON.stringify({
					received: count,
				})
			)
		}, 3000)
	},
})
</script>

<style></style>
